﻿using System.Xml.Linq;
using TVersityDotNet.HelperTypes;
using TVersityDotNet.Responses;
using System.Globalization;

namespace TVersityDotNet.Requests
{
    public class MediaSourceFetchRequest : TVersityRequest
    {
        private int _mediaSourceId;

        public MediaSourceFetchRequest(int mediaSourceId)
        {
            base.Path = "mediasource/fetch";
            this._mediaSourceId = mediaSourceId;
        }

        /// <summary>
        /// Returns the whole string, minus the baseurl used to process this query
        /// </summary>
        public override string RequestString
        {
            get
            {
                return string.Format(CultureInfo.InvariantCulture, "{0}?id={1}", this.Path, this._mediaSourceId.ToString(CultureInfo.InvariantCulture));
            }
        }

        public override TVersityResponse CreateResponse(XDocument xmlDocument)
        {
            MediaSourceFetchResponse response = new MediaSourceFetchResponse(xmlDocument);
            return response;
        }
    }
}
